<?php

class APPCore_Form_Decorator_SubForm extends Zend_Form_Decorator_Abstract
{
    /**
     * Render html of element after decorator
     *
     * @param string $content
     * @return string
     */
    public function render($content)
    {
        $element = $this->getElement();

        /**
         * Decorator of element
         */
        $element->setDecorators(array('FormElements',
            array('HtmlTag', array('tag' => 'table', 'class' => 'zend-subform-table')),
            array(array('Fieldset' => 'HtmlTag'), array_merge(array('tag'=>'fieldset'),$element->getAttribs())),
            array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => '2')),
            array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'class' => 'zend-form-row-group')),
        ));

        return $element->__toString();
    }

}